# from hytest  import *
# from lib.api import *
# import re,json
#
#
# def suite_setup():
#     INFO('返回token')
#     response = requests.post("http://******************/api/v1/auth/userToken",
#                              json={"userAccount": "******************", "password": "******************"}
#                              )
#     global auth_token
#     auth_token = str(response.json()["data"]["token"])
#
#
#
#
# class API_4001:
#     name = 'API_4001'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO('前置条件：用户名正确，密码正确')
#         # urlpara = {             #参数为可选项
#         #     'actTimeEnd':'','actTimeStart':'','alarmTimeEnd':'','alarmTimeStart':'','isAckTime':'','isAlarmTime':'','likeName':'','severity':'','sortParam':'',
#         #     'sortType':'','state':'','subAppId':'','subSystem':''
#         # }
#         response = requests.post("http://******************/services/Message/alarms",
#                                  headers={
#                                      "auth-token": auth_token
#                                  }
#                                  )
#         expectedResult='''
# {
#     "status": "success",
#     "msg": "Alarms",
#     "code": 200,
#     "type": null,
#     "data": [
#         {
#             "pointKey": 98609701,
#             "alarmState": 0,
#             "state": 0,
#             "alarmStateDesc": null,
#             "alarmTimestamp": "2021-05-06 16:11:55",
#             "subSystem": "火灾自动报警系统（FAS）",
#             "subAppId": 101,
#             "actUser": "",
#             "actTimestamp": "",
#             "description": "站台温度报警8关",
#             "trans_type": "NORM",
#             "severity": 5,
#             "locationId": 349,
#             "serverId": null,
#             "stationName": "暂无车站信息"
#         }
#     ]
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
#
# class API_4002:
#     name = 'API_4002'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO('前置条件：用户名正确，密码正确')
#         # urlpara = {             #参数为可选项
#         #     'actTimeEnd':'','actTimeStart':'','alarmTimeEnd':'','alarmTimeStart':'','isAckTime':'','isAlarmTime':'','likeName':'','severity':'','sortParam':'',
#         #     'sortType':'','state':'','subAppId':'','subSystem':''
#         # }
#         response = requests.post("http://******************/services/Message/alarms",
#                                  headers={
#                                      "auth-token": 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlS2V5IjoiIiwidXNlck5hbWUiOiJ5enlhZG1pbiIsImV4cCI6MTYyMjAwNjg2NCwidXNlcklkIjoieXp5YWRtaW4ifQ.-fJYSIJdfbiSabU71x9nbb2n2qbl8IM_s6xk0LuNVfk'
#                                  }
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
# class API_4003:
#     name = 'API_4003'       # 测试用例名字
#     def teststeps(self):
#
#         INFO('数据点接口测试#2.1')
#         INFO('前置条件：用户名正确，密码正确')
#         # urlpara = {             #参数为可选项
#         #     'actTimeEnd':'','actTimeStart':'','alarmTimeEnd':'','alarmTimeStart':'','isAckTime':'','isAlarmTime':'','likeName':'','severity':'','sortParam':'',
#         #     'sortType':'','state':'','subAppId':'','subSystem':''
#         # }
#         response = requests.post("http://******************/services/Message/alarms",
#                                  # headers={
#                                  #     "auth-token": auth_token
#                                  # }
#                                  )
#         expectedResult='''
# {
#     "status": "false",
#     "msg": "请求失败",
#     "code": 1,
#     "type": null,
#     "data": 0
# }
#         '''
#         outExpectedResult='预期结果:'+expectedResult
#         INFO(outExpectedResult)
#         am.printResponse(response)
#         result = sorted(set(re.sub('\\s|{|}|\\[|]','',expectedResult).split(',')) ^ set(re.sub('\\s|{|}|\\[|]','',response.content.decode('utf8')).split(',')))          #对比两个字符串中的不同并打印
#         INFO('\n对比结果：\n'+str(result))
#         CHECK_POINT('是否保持一致',expectedResult==response.content.decode('utf8'))
#
#
#
#
